﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Manager.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="B2B.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<h2>QuotesRecivedPostBuy</h2>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HEAD" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="main_content" runat="server">
       <% ArrayList ds_QuotesRecived_SPM = (ArrayList)ViewData["ds_QuotesRecived_SPM"];
       int i = 0;
    %>
    <h6> Management -> Quotes Recived Post Buy</h6>
    <table>
         <tr style="background-color:#177f75; font-size:17px;color:	#a6fdbf">
             <th style="width:250px">Product</th>
            <th style="width:100px">File</th>            
            <th style="width:250px">Sender</th>
            <th style="width:100px">Tình Trạng</th>
            <th></th>
             <th></th>
        </tr>
        <% foreach(var quote in ds_QuotesRecived_SPM){
               string maBG = ((SP_QuoteRecived)quote).MaBaoGia.ToString();
               string tenSP = ((SP_QuoteRecived)quote).TenSP.ToString();
               string fileName = ((SP_QuoteRecived)quote).File.ToString();
            //   string link = ((SP_QuoteRecived)quote).Link.ToString();
               string sender = ((SP_QuoteRecived)quote).EmailNguoiGui.ToString();
               int tinhTrang = ((SP_QuoteRecived)quote).TinhTrang;
               string chuoiTinhTrang = "";
               switch (tinhTrang)
               {
                   case 1: chuoiTinhTrang = "Reject"; break;
                   case 2: chuoiTinhTrang = "Accept"; break;
                   default: chuoiTinhTrang = "Waiting"; break;
               }               
          if(i % 2 ==0)
               {
        %>
             <tr style="background-color:#d1bff0; font-size:14px">
                <td><a style="color:black" href=#"> <%=tenSP %></a></td>
                <td align="center"><a style="color:black" href="/Files/Download?file=<%=fileName %>"><%=fileName %></a> </td>
                <td style="color:black" align="center"><%=sender %></td>
                <td style="color:black" align="center"><%=chuoiTinhTrang %></td>
                 <td>
                     <%if(tinhTrang == 0){ %>
                     <form action="/Manage/CreateOrder/<%=maBG %>"> <input type="submit" value="Create Order"/></form>
                     <%} %>
                 </td>
                 <td style="color:black"> 
                    <%if(tinhTrang == 0){ %>
                        
                    
                         <form action="/Manage/UpdateQuoteRecived" method="post">
                             <input type="submit" value="reject" />
                            <input type="hidden" name="id" value="<%=maBG %>" />
                            <input type="hidden" name="tinhTrang" value="1" />
                        </form>
                    <%} %>
                </td>
            </tr>
        <%} 
          else
          {                     
        %>
            <tr style="font-size:14px">
                <td><a  href="#"> <%=tenSP %></a></td>
                <td align="center"><a href="/Files/Download?file=<%=fileName %>"><%=fileName %></a> </td>
                <td align="center"><%=sender %></td>
                <td align="center"><%=chuoiTinhTrang %></td>
                 <td>
                     <%if(tinhTrang == 0){ %>
                     <form action="/Manage/CreateOrder/<%=maBG %>"> <input type="submit" value="Create Order"/></form>
                     <%} %>
                 </td>
                <td > 
                    <%if(tinhTrang == 0){ %>
                       
                         <form action="/Manage/UpdateQuoteRecived" method="post">
                             <input type="submit" value="reject" />
                            <input type="hidden" name="id" value="<%=maBG %>" />
                            <input type="hidden" name="tinhTrang" value="1" />
                        </form>
                    <%} %>
                </td>
            </tr>
        <%}%>
        <%i++;
           } %>

        
    </table>
    <div  id="trigger-list">
        <% 
            int tongtrangNhan = int.Parse(ViewData["tongtrang_nhanSPM"].ToString());
            for(int j = 0; j < tongtrangNhan; j++)
            {
        %>
            <a class="trigger error-trigger" href="/Manage/QuotesRecivedPostBuy/<%=j %>"><%=j+1 %></a>
        <%
        }
        %>
    </div>
</asp:Content>
